const express =require('express')
const router = express.Router()
const expressJoi = require('@escook/express-joi')
const {add_post_schema, del_post_schema,update_post_schema,get_post_schema} = require('../schema/postinfo')

const postinfoHandler = require('../router_handler/postinfo')

// 增
router.post('/addPost', expressJoi(add_post_schema), postinfoHandler.addPost)
// 删
router.post('/delPost/:id', expressJoi(del_post_schema), postinfoHandler.delPost)
// 改
router.post('/updatePost', expressJoi(update_post_schema), postinfoHandler.updatePost)
// 查
router.get('/getPostAll', expressJoi(get_post_schema), postinfoHandler.getPostAll)

module.exports = router